document.getElementById("createxiti").onclick=function(){
	window.open ("type.html?type=POST", "_blank", "height=300, width=600, top=160, left=200, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
	
}
function getList(){
	$.ajax({
		"url":"/serial_type_admin/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"dataType":"jsonp",
		"success":function(data){
			if(!data.status){
				showErrorInfo(data.content)
				return false;
			}
			var tab=document.getElementById("tab")	
			var data=data.content;
			for(var i=0;i<data.length;i++){
				var tr=document.createElement("tr")

				var td=document.createElement("td")
				td.textContent=data[i].id;
				tr.appendChild(td)
			
				var td=document.createElement("td")
				td.textContent=data[i].name;
				tr.appendChild(td)
			
				var td=document.createElement("td")
				var eBtn=document.createElement("btn")
				eBtn.setAttribute("data",JSON.stringify(data[i]))
				eBtn.onclick=function(){
					var data=this.getAttribute("data")
					window.open ("type.html?type=PUT&data="+data, "_blank", "height=300, width=600, top=160, left=200, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
				}
				eBtn.className="btn btn-primary btn-sm"
				eBtn.textContent="修改"
				 td.appendChild(eBtn)   
				 tr.appendChild(td)   

				tab.appendChild(tr)
			
			}
		
		}
	})
}
getList()
